package com.platform.metamodel;

import java.util.function.Function;

/**
 * @author liujizheng
 * @version 1.0
 * @name Mappings
 * @Desc 映射配置关系
 * @date 2022/3/8 15:53
 */
public interface Mappings<T extends Mappings> {

    /**
     * 添加映射配置
     *
     * @param key       键值
     * @param keyMapper 键映射
     * @param valueMapper 值映射
     * @return mappings
     */
    T addMapper(String key, Function<String, String> keyMapper, Function<Object, Object> valueMapper);

    /**
     * 添加映射配置
     *
     * @param key       键值
     * @param valueMapper 值映射
     * @return mappings
     */
    default T addMapper(String key, Function<Object, Object> valueMapper) {
        return addMapper(key, Function.identity(), valueMapper);
    }
}
